﻿using System;

class ExtractPalindromesFromText
{
    static void Main()
    {
        //Exercise 20.
        //Write a program that extracts from a given text all palindromes, e.g. "ABBA", "lamal", "exe".

        string text = "ABBA is a group, while I have no idea what lamal means. Exe is a file extension.";
        char[] separators = { ' ', ',', '.', '!', '\n', '\r' };
        string[] words = text.Split(separators, StringSplitOptions.RemoveEmptyEntries);
        foreach (var word in words)
        {
            bool isPalindrome = true;
            for (int i = 0; i < word.Length / 2; i++)
            {
                if (word[i] != word[word.Length - 1 - i])
                {
                    isPalindrome = false;
                    break;
                }
            }
            if (isPalindrome && word.Length > 1)
            {
                Console.WriteLine(word);
            }
        }


    }
}

